package org.jeecg.modules.brand.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.brand.entity.IBrand;
import org.jeecg.modules.brand.service.IIBrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

/**
 * @Description: i_brand
 * @Author: jeecg-boot
 * @Date: 2024-06-03
 * @Version: V1.0
 */
@Api(tags = "i_brand")
@RestController
@RequestMapping("/brand/iBrand")
@Slf4j
public class IBrandController extends JeecgController<IBrand, IIBrandService> {
    @Autowired
    private IIBrandService iBrandService;

    /**
     * 分页列表查询
     *
     * @return
     */
    @ApiOperation(value = "产品查询", notes = "产品查询")
    @GetMapping(value = "/list")
    public Result<List<IBrand>> queryPageList() {
        LocalDate localDate = LocalDate.now();
        LambdaQueryWrapper<IBrand> queryWrapper = Wrappers.lambdaQuery(IBrand.class)
                .eq(IBrand::getVersionDate, localDate).orderByDesc(IBrand::getBrowse);
        return Result.OK(iBrandService.list(queryWrapper));
    }
}
